"""
# -*- coding: utf-8 -*-
# @Time    : 2023/6/17 11:00
# @Author  : 王摇摆
# @FileName: VGG16.py
# @Software: PyCharm
# @Blog    ：https://blog.csdn.net/weixin_44943389?type=blog
"""
import matplotlib.pyplot as plt

# Data for VGGNet
vggnet_epochs = range(1, 21)
vggnet_train_loss = [0.6932, 0.6772, 0.6502, 0.6340, 0.6209, 0.6062, 0.5837, 0.5690, 0.5543, 0.5417,
                     0.5315, 0.5126, 0.4953, 0.4751, 0.4570, 0.4472, 0.4332, 0.4233, 0.4099, 0.3994]
vggnet_train_acc = [49.53, 56.69, 62.215, 64.62, 65.905, 67.64, 69.365, 70.265, 71.12, 72.67,
                    73.285, 74.355, 75.505, 77.545, 78.38, 79.025, 79.87, 80.37, 81.265, 82.25]
vggnet_valid_loss = [0.6943, 0.6499, 0.6241, 0.6100, 0.6095, 0.5719, 0.6165, 0.5530, 0.5304, 0.5662,
                     0.5073, 0.4934, 0.4985, 0.5001, 0.4561, 0.4516, 0.4406, 0.4156, 0.4656, 0.4109]
vggnet_valid_acc = [50.0, 61.96, 65.4, 66.58, 66.42, 70.48, 66.12, 71.7, 73.48, 70.0,
                    74.68, 75.74, 75.52, 76.66, 78.14, 78.68, 78.86, 80.62, 77.36, 80.96]

# Data for VGG16
vgg16_epochs = range(1, 21)
vgg16_train_loss = [0.3727, 0.3281, 0.3052, 0.2802, 0.2582, 0.2298, 0.1991, 0.1644, 0.1353, 0.1022,
                    0.0834, 0.0665, 0.0547, 0.0439, 0.0373, 0.0364, 0.0381, 0.0291, 0.0324, 0.0312]
vgg16_train_acc = [82.84, 85.45, 86.325, 87.79, 88.725, 90.285, 91.655, 93.35, 94.665, 96.14,
                   96.99, 97.7, 98.14, 98.49, 98.675, 98.71, 98.625, 99.105, 98.925, 99.11]
vgg16_valid_loss = [0.3386, 0.3329, 0.3249, 0.3316, 0.3312, 0.3337, 0.3488, 0.3746, 0.4272, 0.4853,
                    0.5118, 0.5562, 0.6003, 0.643, 0.683, 0.7103, 0.7167, 0.7362, 0.7485, 0.7983]
vgg16_valid_acc = [84.44, 84.82, 85.34, 85.36, 85.86, 85.86, 85.38, 85.64, 85.8, 85.16,
                   85.04, 84.24, 85.34, 84.88, 84.92, 85.14, 84.7, 85.4, 85.14, 84.96]

# Plotting
plt.figure(figsize=(12, 6))

# Loss plot
plt.subplot(1, 2, 1)
plt.plot(vggnet_epochs, vggnet_train_loss, label='VGGNet Train')
plt.plot(vggnet_epochs, vggnet_valid_loss, label='VGGNet Valid')
plt.plot(vgg16_epochs, vgg16_train_loss, label='VGG16 Train')
plt.plot(vgg16_epochs, vgg16_valid_loss, label='VGG16 Valid')
plt.title('Training and Validation Loss')
plt.xlabel('Epochs')
plt.ylabel('Loss')
plt.legend()

# Accuracy plot
plt.subplot(1, 2, 2)
plt.plot(vggnet_epochs, vggnet_train_acc, label='VGGNet Train')
plt.plot(vggnet_epochs, vggnet_valid_acc, label='VGGNet Valid')
plt.plot(vgg16_epochs, vgg16_train_acc, label='VGG16 Train')
plt.plot(vgg16_epochs, vgg16_valid_acc, label='VGG16 Valid')
plt.title('Training and Validation Accuracy')
plt.xlabel('Epochs')
plt.ylabel('Accuracy')
plt.legend()

# Display the plots
plt.tight_layout()
plt.show()
